package club.justwill.single.persistence.jpo;

import club.justwill.single.persistence.support.HistoryJpo;
import club.justwill.single.persistence.support.InvitationBase;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created by luoyu on 15-12-24.
 */
@Entity
@Table(name = "invitation_history")
public class InvitationHistory extends InvitationBase  implements HistoryJpo<Invitation> {

    @Column(name = "invitee_id")
    private long inviteeId;

    @Column(name = "inviter_id")
    private long inviterId;

    @Id
    @Column(name = "sequence")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long sequence;

    public Long getSequence() {
        return sequence;
    }

    public void setSequence(Long sequence) {
        this.sequence = sequence;
    }

    @Override
    public void copy(Invitation obj) {
        super.copyBase(obj);
    }

    public long getInviterId() {
        return inviterId;
    }

    public void setInviterId(Long inviterId) {
        if(inviterId == null) {
            this.inviteeId = 0L;
        } else {
            this.inviterId = inviterId;
        }
    }

    public long getInviteeId() {
        return inviteeId;
    }

    public void setInviteeId(Long inviteeId) {
        if(inviteeId == null) {
            this.inviteeId = 0L;
        } else {
            this.inviteeId = inviteeId;
        }
    }
}
